<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${user.id != null} ? '编辑用户 - 权限管理系统' : '新增用户 - 权限管理系统'">编辑用户 - 权限管理系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #667eea;
            --secondary-color: #764ba2;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8fafc;
        }

        .sidebar {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            color: white;
            height: 100vh;
            position: fixed;
            width: 280px;
            box-shadow: 5px 0 15px rgba(0,0,0,0.1);
            z-index: 1000;
        }

        .main-content {
            margin-left: 280px;
            padding: 30px;
            min-height: 100vh;
        }

        .nav-link {
            color: rgba(255,255,255,0.9) !important;
            padding: 15px 25px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            transition: all 0.3s ease;
            font-weight: 500;
        }

        .nav-link:hover {
            background: rgba(255,255,255,0.15);
            padding-left: 30px;
            color: white !important;
        }

        .nav-link.active {
            background: rgba(255,255,255,0.2);
            border-left: 4px solid white;
            color: white !important;
        }

        .form-card {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.08);
        }

        .form-control, .form-select {
            border-radius: 10px;
            border: 2px solid #e9ecef;
            padding: 12px 15px;
            transition: all 0.3s ease;
        }

        .form-control:focus, .form-select:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
        }
    </style>
</head>
<body>
<!-- 侧边栏 -->
<div class="sidebar">
    <div class="p-4">
        <div class="d-flex align-items-center mb-3">
            <div style="width: 50px; height: 50px; border-radius: 12px; background: white; display: flex; align-items: center; justify-content: center;" class="me-3">
                <i class="fas fa-shield-alt text-primary"></i>
            </div>
            <div>
                <h5 class="mb-0">权限管理系统</h5>
                <small class="opacity-75" th:text="${user.id != null} ? '编辑用户' : '新增用户'">编辑用户</small>
            </div>
        </div>
        <p class="mb-0 text-light opacity-75">
            <i class="fas fa-user me-2"></i><span th:text="${currentUser.name}">用户</span>
        </p>
    </div>
    <nav class="nav flex-column">
        <a class="nav-link" href="/dashboard">
            <i class="fas fa-home me-3"></i>系统首页
        </a>
        <a class="nav-link" href="/user/management">
            <i class="fas fa-users me-3"></i>用户管理
        </a>
        <a class="nav-link" href="/role/management">
            <i class="fas fa-user-shield me-3"></i>权限管理
        </a>
        <a class="nav-link" href="/user/profile">
            <i class="fas fa-user-cog me-3"></i>个人信息
        </a>
        <a class="nav-link" href="/logout">
            <i class="fas fa-sign-out-alt me-3"></i>退出登录
        </a>
    </nav>
</div>

<!-- 主内容区 -->
<div class="main-content">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h2 class="mb-1">
                <i class="fas fa-user-edit me-2 text-primary"></i>
                <span th:text="${user.id != null} ? '编辑用户' : '新增用户'">编辑用户</span>
            </h2>
            <p class="text-muted mb-0" th:text="${user.id != null} ? '修改用户信息' : '创建新用户'">修改用户信息</p>
        </div>
        <a href="/user/management" class="btn btn-outline-secondary">
            <i class="fas fa-arrow-left me-2"></i>返回列表
        </a>
    </div>

    <div class="form-card">
        <form>
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label class="form-label fw-semibold">登录名</label>
                    <input type="text" class="form-control" th:value="${user.loginname}"
                           placeholder="请输入登录名" required>
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label fw-semibold">姓名</label>
                    <input type="text" class="form-control" th:value="${user.name}"
                           placeholder="请输入真实姓名" required>
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label fw-semibold">邮箱</label>
                    <input type="email" class="form-control" th:value="${user.email}"
                           placeholder="请输入邮箱地址">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label fw-semibold">手机号</label>
                    <input type="tel" class="form-control" th:value="${user.mobilephone}"
                           placeholder="请输入手机号码">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label fw-semibold">性别</label>
                    <select class="form-select">
                        <option value="1" th:selected="${user.sex == 1}">男</option>
                        <option value="2" th:selected="${user.sex == 2}">女</option>
                    </select>
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label fw-semibold">状态</label>
                    <select class="form-select">
                        <option value="0" th:selected="${user.status == 0}">正常</option>
                        <option value="1" th:selected="${user.status == 1}">禁用</option>
                    </select>
                </div>
                <div class="col-12 mb-3">
                    <label class="form-label fw-semibold">地址</label>
                    <input type="text" class="form-control" th:value="${user.address}"
                           placeholder="请输入地址">
                </div>
            </div>

            <div class="d-flex gap-2 mt-4">
                <button type="submit" class="btn btn-primary">
                    <i class="fas fa-save me-2"></i>保存
                </button>
                <a href="/user/management" class="btn btn-outline-secondary">取消</a>
            </div>
        </form>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>